/*  1:   */package com.linkage.bss.commons.util;
/*  2:   */
/*  3:   */import java.text.SimpleDateFormat;
/*  4:   */import java.util.Date;
/*  5:   */import net.sf.json.JsonConfig;
/*  6:   */import net.sf.json.processors.JsonValueProcessor;
/*  7:   */
/* 13:   */public class JsonDateValueProcessor
/* 14:   */  implements JsonValueProcessor
/* 15:   */{
/* 16:16 */  private String format = "yyyy-MM-dd HH:mm:ss";
/* 17:   */  
/* 19:   */  public JsonDateValueProcessor() {}
/* 20:   */  
/* 21:   */  public JsonDateValueProcessor(String format)
/* 22:   */  {
/* 23:23 */    this.format = format;
/* 24:   */  }
/* 25:   */  
/* 26:   */  public Object processArrayValue(Object value, JsonConfig jsonConfig) {
/* 27:27 */    return process(value, jsonConfig);
/* 28:   */  }
/* 29:   */  
/* 30:   */  public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) {
/* 31:31 */    return process(value, jsonConfig);
/* 32:   */  }
/* 33:   */  
/* 34:   */  private Object process(Object value, JsonConfig jsonConfig) {
/* 35:35 */    if ((value instanceof Date)) {
/* 36:36 */      String str = new SimpleDateFormat(this.format).format((Date)value);
/* 37:37 */      return str;
/* 38:   */    }
/* 39:39 */    return value == null ? null : value.toString();
/* 40:   */  }
/* 41:   */  
/* 42:   */  public String getFormat() {
/* 43:43 */    return this.format;
/* 44:   */  }
/* 45:   */  
/* 46:   */  public void setFormat(String format) {
/* 47:47 */    this.format = format;
/* 48:   */  }
/* 49:   */}


/* Location:           E:\workspace\sungl111\workspace_promotion\BizHallConfig\WebRoot\WEB-INF\lib\bss.commons-0.1.jar
 * Qualified Name:     com.linkage.bss.commons.util.JsonDateValueProcessor
 * JD-Core Version:    0.7.0-SNAPSHOT-20130630
 */